<template>
  <div>
    <n-button @click="doOpen">打开模态</n-button>
    <p-modal ref="$modal" @close="doClose" @save="doSave"></p-modal>
  </div>
</template>

<script lang="ts" setup>
import { PModal, type PModalMethods } from "components/index";
import { getCurrentInstance, ref } from "vue";
const $modal = ref<PModalMethods>();
const doOpen = () => {
  $modal.value?.open();
  getCurrentInstance();
};

const doClose = () => {
  console.log("关闭");
  return true;
};

const doSave = () => {
  console.log("保存");
  return true;
};
</script>

<style lang="less" scoped></style>
